<?php

namespace App\Service;

use EasyWeChat\Factory;

class Wechat
{
    public static function miniProgram(): \EasyWeChat\MiniProgram\Application
    {
        $config = [
            'app_id' => env('MP_APP_ID'),
            'secret' => env('MP_SECRET'),

            // 下面为可选项
            // 指定 API 调用返回结果的类型：array(default)/collection/object/raw/自定义类名
            'response_type' => 'array',

            'log' => [
                'level' => 'debug',
                'file' => storage_path('/logs') . '/wechat.log',
            ],
        ];

        return Factory::miniProgram($config);
    }
}
